<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>栏目管理</title>
<link href="css_body.css" rel="stylesheet" type="text/css" />
<script language="javascript">
var channelArray = new Array();
<?php
$i = 0;
foreach($channelArray as $k=>$arr)
{
echo "channelArray[$k] = \"{$arr['nid']}\";\r\n";
}
?>

function SelectTemplets(fname){
   var posLeft = window.event.clientY-200;
   var posTop = window.event.clientX-300;
   window.open("../include/dialog/select_templets.php?f="+fname, "poptempWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=400,left="+posLeft+", top="+posTop);
}

function ShowHide(objname){
  var obj = document.getElementById(objname);
  if(obj.style.display == "block" || obj.style.display == "")
	   obj.style.display = "none";
  else
	   obj.style.display = "block";
}

function ShowObj(objname){
   var obj = document.getElementById(objname);
	 obj.style.display = "block";
}

function HideObj(objname){
  var obj = document.getElementById(objname);
	obj.style.display = "none";
}

function ShowItem1(){
  ShowObj('head1'); ShowObj('needset'); HideObj('head2'); HideObj('adset');
}

function ShowItem2(){
  ShowObj('head2'); ShowObj('adset'); HideObj('head1'); HideObj('needset');
}

function ShowSonList(){
   if(document.form1.needson.checked){
      ShowObj('sonlist');
   }else{
      HideObj('sonlist');
   }
}

function CheckTypeDir(){
  var upinyin = document.getElementById('upinyin');
  var tpobj = document.getElementById('typedir');
  if(upinyin.checked) tpobj.style.display = "none";
  else tpobj.style.display = "block";
}

function ParTemplet(obj)
{
  var sevvalue = channelArray[obj.value];
  var tempindex = document.getElementsByName('tempindex');
  var templist = document.getElementsByName('templist');
  var temparticle = document.getElementsByName('temparticle');
  var dfstyle = document.getElementsByName('dfstyle');
  var dfstyleValue = dfstyle[0].value;
  tempindex[0].value = dfstyleValue+"/index_"+sevvalue+".htm";
  templist[0].value = dfstyleValue+"/list_"+sevvalue+".htm";
  temparticle[0].value = dfstyleValue+"/article_"+sevvalue+".htm";
}

function checkSubmit()
{
   if(document.form1.typename.value==""){
		  alert("栏目名称不能为空！");
		  return false;
	 }
	 return true;
}

function CheckPathSet()
{
	var surl = document.getElementById("siteurl");
	var sreid = document.getElementById("reID");
	var mysel = document.getElementById("truepath3");
	if(surl.value!=""){
		if(sreid.value=="0" || sreid.value==""){
			mysel.checked = true;
		}
	}
}

</script>
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF}
-->
</style>
</head>
<body leftmargin='15' topmargin='10'>
<table width="96%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="	background:#E2F5BC;">
  <tr>
    <td width="100%" height="20" valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="30">&nbsp;<a href="catalog_main.php"><u>栏目管理</u></a>&gt;&gt;增加栏目</td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="96%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="	background:#E2F5BC;">
  <tr>
  <form name="form1" action="catalog_add.php" method="post" onSubmit="return checkSubmit();">
  <input type="hidden" name="dopost" value="save">
  <input type="hidden" name="reID" id="reID" value="<?php echo $ID;?>">
  <?php
  if($listtype!="all")
  {
  	echo "<input type='hidden' name='moresite' value='{$myrow['moresite']}'>\r\n";
  	echo "<input type='hidden' name='siterefer' value='{$myrow['siterefer']}'>\r\n";
  	echo "<input type='hidden' name='sitepath' value='{$myrow['sitepath']}'>\r\n";
  	echo "<input type='hidden' name='siteurl' value='{$myrow['siteurl']}'>\r\n";
  }
  ?>
    <td height="95" align="center" bgcolor="#FFFFFF">
    <table width="100%" border="0" cellspacing="0" id="head2" cellpadding="0" style="display:none">
          <tr>
            <td colspan="2" align="left" bgcolor="#EDF9D5">
<table width="168" height="24" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="84" align="center" bgcolor="#006600"><a href="#" onClick="ShowItem1()" class="STYLE1">
                  	<u>常规选项</u></a>&nbsp;</td>
                  <td width="84" align="center" bgcolor="#FFFFFF">高级选项&nbsp;</td>
                </tr>
              </table>
            </td>
          </tr>
       </table>
	    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="htable" id="head1">
          <tr>
            <td colspan="2" align="left" bgcolor="#EDF9D5">
            <table width="168" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="84" height="24" align="center" bgcolor="#FFFFFF">&nbsp;常规选项&nbsp;</td>
                  <td width="84" align="center" bgcolor="#006600"><a href="#" class="STYLE1" onclick="ShowItem2()"><u>高级选项</u></a></td>
                </tr>
            </table></td>
          </tr>
        </table>
	    <table width="98%" border="0"  id="needset" cellspacing="0" cellpadding="0">
          <tr>
            <td width="120" height="26" align="left" class='bline'>是否支持投稿：</td>
          <td align="left" class='bline'>
           	  <input type='radio' name='issend' value='0' class='np' <?php if($issend=="0") echo " checked";?>>
              不支持&nbsp;
              <input type='radio' name='issend' value='1' class='np' <?php if($issend=="1") echo " checked";?>>
              支持             </td>
          </tr>
          <tr>
            <td width="120" height="26" align="left" class='bline'>是否隐藏栏目：</td>
          <td align="left" class='bline'>
           	  <input type='radio' name='ishidden' value='0' class='np' checked>
              显示　&nbsp;
              <input type='radio' name='ishidden' value='1' class='np'>
              隐藏             </td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>栏目名称：</td>
            <td align="left" class='bline'><input name="typename" type="text" id="typename" size="30"></td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'> 排列顺序： </td>
            <td align="left" class='bline'><input name="sortrank" size="6" type="text" value="50">
              （由低 -&gt; 高） </td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>浏览权限：</td>
          <td align="left" class='bline'>
           	  <select name="corank" id="corank" style="width:100px">
                <?php
              $dsql->SetQuery("Select * from #@__arcrank where rank >= 0");
              $dsql->Execute();
              while($row = $dsql->GetObject())
              {
              	if($corank==$row->rank) echo "<option value='".$row->rank."' selected>".$row->membername."</option>\r\n";
				        else
				        {
				        	//如果上级目录的corank>0，下级必须继承
				        	if($corank==0)
				        	{ echo "<option value='".$row->rank."'>".$row->membername."</option>\r\n"; }
				        }
              }
              ?>
              </select>
              (本权限仅对<strong><font color="#0000FF">最终列表栏目</font></strong>有效，设置后本栏目发布或审核后的所有文档将使用此权限)            </td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>上级目录：</td>
            <td align="left" class='bline'>
              <?php
            $pardir = "{cmspath}".$cfg_arcdir;
            if(!empty($typedir) || $moresite==1) $pardir = $typedir."/";
            $pardir = ereg_replace("/{1,}","/",$pardir);
            echo $pardir;
            ?>
            <input name="nextdir" type="hidden" id="nextdir" value="<?php echo $pardir?>">            </td>
          </tr>

          <tr>
            <td height="26" align="left" class='bline'>文件保存目录：</td>
          <td align="left" class='bline'>
           	  <table width="500" border="0" cellspacing="1" cellpadding="1">
                <tr>
                  <td width="200">
                  	<input name="typedir" type="text" id="typedir" style="width:300px">                  </td>
                  <td width="300">
                  <input name="upinyin" type="checkbox" id="upinyin" class="np" value="1" onClick="CheckTypeDir()">
                  拼音                  </td>
                </tr>
              </table>              </td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>目录相对位置：</td>
      <td align="left" class='bline'>
	          <input name="referpath" type="radio" id="truepath1" class="np" value="parent" checked>
              上级目录
              <?php
              if($moresite==0){
              ?>
              <input name="referpath" type="radio" id="truepath2" class="np" value="cmspath">
              CMS根目录
              <?php  } ?>
              <input name="referpath" type="radio" id="truepath3" class="np" value="basepath">
              站点根目录              </td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>内容模型： &nbsp; </td>
            <td align="left" class='bline'>
           <select name="channeltype" id="channeltype" style="width:200px" onChange="ParTemplet(this)">
            <?php
            foreach($channelArray as $k=>$arr)
            {
            	if($k==$channelid) echo "    <option value='{$k}' selected>{$arr['typename']}|{$arr['nid']}</option>\r\n";
              else  echo "    <option value='{$k}'>{$arr['typename']}|{$arr['nid']}</option>\r\n";
            }
            ?>
              </select>            </td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>栏目列表选项：</td>
            <td align="left" class='bline'> <input type='radio' name='isdefault' value='1' class='np' checked>
              链接到默认页
              <input type='radio' name='isdefault' value='0' class='np'>
              链接到列表第一页
              <input type='radio' name='isdefault' value='-1' class='np'>
              使用动态页 </td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>默认页的名称： </td>
            <td align="left" class='bline'><input name="defaultname" type="text" value="index.html"></td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>栏目属性：</td>
            <td align="left" class='bline'><input name="ispart" type="radio" id="radio" value="0" class='np' checked>
最终列表栏目（允许在本栏目发布文档，并生成文档列表） <br>
<input name="ispart" type="radio" id="radio" value="1" class='np'>
频道封面（栏目本身不允许发布文档） <br>
<input name="ispart" type="radio" id="radio" value="2" class='np'>
单独页面（栏目本身不允许发布文档） <br>
<input name="ispart" type="radio" id="radio" value="3" class='np'>
跳转网址（在文件保存目录处填写完整网址）
</td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>启用小分类：</td>
            <td align="left" class='bline'>
			<input name="needson" type="checkbox" class="np" id="needson" value="1" onClick="ShowSonList()">
            启用
			（仅适用于分类信息等互动模型）</td>
          </tr>
          <tr id="sonlist" style="display:none">
            <td height="26" align="left" class='bline'>小分类：</td>
            <td align="left" class='bline' style='padding-top:5px;padding-bottom:5px;'>
			<select name="sonlists[]" id="sonlists" style="width:200px" size="6" multiple="multiple">
              <?php
			  $dsql->SetQuery("select id,name from #@__smalltypes order by disorder asc");
              $dsql->Execute();
			  while($row = $dsql->GetObject()){
			     echo "        <option value='{$row->id}'>{$row->name}</option>\r\n";
			  }
			  ?>
            </select>
			(按Ctrl多选)
            </td>
          </tr>
        </table>
	    <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" id="adset" style="display:none">
          <?php
          if($listtype=="all")
          {
          ?>
<tr>
            <td width="120" height="24" align="left" class='bline'>多站点支持：</td>
            <td align="left" class='bline'> <input name="moresite" type="radio"  class="np" value="0" checked>
              不启用
              <input type="radio" name="moresite" class="np" value="1">
            启用 </td>
          </tr>
          <tr>
            <td height="24" align="left" bgcolor="#B9E9FF">说明：</td>
            <td align="left" bgcolor="#B9E9FF">绑名绑定仅需要在顶级栏目设定，下级栏目的目录和域名将相对于顶级栏目。</td>
          </tr>
          <tr>
            <td height="24" align="left" class='bline'>绑定域名：</td>
            <td align="left" class='bline'>
           	  <input name="siteurl" type="text" id="siteurl" size="35" onChange="CheckPathSet();">
              (需加 http://，一级或二级域名的根网址)
            </td>
          </tr>
          <tr>
            <td height="24" align="left" class='bline'>站点根目录：</td>
            <td align="left" class='bline'>
            	<input name="sitepath" type="text" id="sitepath" size="35">
              <input name="siterefer" type="radio" class="np" id="truepath" value="1" checked>
              相对于主站点根目录
              <input name="siterefer" type="radio" id="truepath" class="np" value="2">
              绝对路径
            </td>
          </tr>
          <?php
          }
          ?>
		  <tr id='helpvar1' style='display:none'>
            <td height="24" align="left" bgcolor="#B9E9FF">支持变量： </td>
            <td align="left" bgcolor="#B9E9FF"> {tid}表示栏目ID，<br>
              {cid}表示频道模型的'名字ID' <font color='#888888'> （
              <?php
              foreach($channelArray as $k=>$arr)
              {
            	   echo "{$arr['typename']}({$arr['nid']})、";
              }
             ?>
              ） </font> <br/>
              模板文件的默认位置是放在模板目录 "cms安装目录
              <?php echo $cfg_templets_dir ?>
              " 内。
              <input type='hidden' value='{style}' name='dfstyle'>
            </td>
          </tr>
          <tr>
            <td height="33" align="left">封面模板：</td>
            <td height="33" align="left"> <input name="tempindex" type="text" value="{style}/index_<?php echo $nid?>.htm" style="width:300px">
              <input type="button" name="set1" value="浏览..." style="width:60px" onClick="SelectTemplets('form1.tempindex');" class="inputbut">
              <img src="img/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:hand" onClick="ShowHide('helpvar1')">
            </td>
  </tr>
          <tr>
            <td height="33" align="left">列表模板：</td>
            <td height="33" align="left"> <input name="templist" type="text" value="{style}/list_<?php echo $nid?>.htm" style="width:300px">
              <input type="button" name="set3" value="浏览..." style="width:60px" onClick="SelectTemplets('form1.templist');" class="inputbut">
            </td>
  </tr>
          <tr>
            <td height="33" align="left">文章模板：</td>
            <td height="33" align="left"><input name="temparticle" type="text" value="{style}/article_<?php echo $nid?>.htm" style="width:300px">
              <input type="button" name="set4" value="浏览..." style="width:60px" onClick="SelectTemplets('form1.temparticle');" class="inputbut">
            </td>
  </tr>
          <tr>
            <td height="33" align="left">单独页面模板：</td>
            <td height="33" align="left"><input name="tempone" type="text" value="" style="width:300px">
              <input type="button" name="set2" value="浏览..." style="width:60px" onClick="SelectTemplets('form1.tempone');" class="inputbut">
            </td>
  </tr>
          <tr id='helpvar2' style='display:none'>
            <td height="24" align="left" bordercolor="#00CCFF" bgcolor="#B9E9FF">支持变量： </td>
            <td height="24" align="left" bgcolor="#B9E9FF"> {Y}、{M}、{D} 年月日<br/>
              {timestamp} INT类型的UNIX时间戳<br/>
              {aid} 文章ID<br/>
              {pinyin} 拼音+文章ID<br/>
              {py} 拼音部首+文章ID<br/>
              {typedir} 栏目目录 <br/>
              {cc} 日期+ID混编后用转换为适合的字母 <br/>
            </td>
          </tr>
          <tr>
            <td height="26" align="left">文章命名规则：</td>
            <td align="left"> <input name="namerule" type="text" id="namerule" value="<?php echo $cfg_df_namerule;?>" size="40">
              <img src="img/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:hand" onClick="ShowHide('helpvar2')">
            </td>
          </tr>
          <tr id='helpvar3' style='display:none'>
            <td height="24" align="left" bgcolor="#B9E9FF">支持变量： </td>
            <td align="left" bgcolor="#B9E9FF">{page} 列表的页码</td>
          </tr>
          <tr>
            <td height="26" align="left">列表命名规则：</td>
            <td align="left">
              <input name="namerule2" type="text" id="namerule2" value="<?php echo $cfg_df_listnamerule;?>" size="40">
            <img src="img/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:hand" onClick="ShowHide('helpvar3')"></td>
          </tr>
		  <tr>
            <td height="26" align="left" class='bline'>栏目缩略图：</td>
            <td align="left" class='bline'>&nbsp;</td>
          </tr>
          <tr>
            <td height="65" align="left">关键字：</td>
            <td align="left"> <textarea name="keywords" cols="40" rows="3" id="keywords"></textarea>
            </td>
          </tr>
          <tr>
            <td height="65" align="left">栏目描述：</td>
            <td height="65" align="left"> <textarea name="description" cols="40" rows="3" id="textarea2"></textarea></td>
          </tr>
        </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
            <td height="50">
<input name="imageField" type="submit" class="inputbut" value="确定">
&nbsp;&nbsp;&nbsp;
            <a href="catalog_main.php"><input type="button" name="button" id="button" value="返回" class="inputbut"/>
            </a>            </td>
            </tr>
      </table></td>
    </form>
  </tr>
</table>
</body>
</html>